package Modele;

import java.awt.Image;

import javax.swing.ImageIcon;

public class TypeRessource {

	private int type;
	private String nom;
	private Image image;
	private static TypeRessource[] typesRessources = new TypeRessource[7];
	private static int nbTypesRessources = 0;
	
	public TypeRessource(int t, Image img, String n) {
		this.type = t;
		this.image = img;
		this.nom = n;
		TypeRessource.typesRessources[TypeRessource.nbTypesRessources] = this;
		TypeRessource.nbTypesRessources ++;
	}
	
	public static Image getImage(int type) {
		int i;
		for (i = 0 ; i < TypeRessource.typesRessources.length ; i ++) {
			if (TypeRessource.typesRessources[i].type == type)
				break;
		}
		return TypeRessource.typesRessources[i].image;
	}
	
	public int getType() {
		return this.type;
	}
	
	public String getNom() {
		return this.nom;
	}
	
	public ImageIcon getIcon() {
		ImageIcon ii = null;
		switch (this.type) {
			case 1 : 
				ii = new ImageIcon("./src/Images/Ressources/Argent.GIF");
				break;
			case 2 : 
				ii = new ImageIcon("./src/Images/Ressources/Bois.GIF");
				break;
			case 3 : 
				ii = new ImageIcon("./src/Images/Ressources/Pierre.GIF");
				break;
			case 4 : 
				ii = new ImageIcon("./src/Images/Ressources/Gemme.GIF");
				break;
			case 5 : 
				ii = new ImageIcon("./src/Images/Ressources/Cristal.GIF");
				break;
			case 6 : 
				ii = new ImageIcon("./src/Images/Ressources/Soufre.GIF");
				break;
			case 7 : 
				ii = new ImageIcon("./src/Images/Ressources/Mercure.GIF");
				break;
		}
		return ii;
	}
	
}
